﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AlluScript : System.Web.UI.UserControl
{
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            AlluWizard.ActiveStepIndex = 0;
        }
        else
        {
        }

        lblAgentFirst.Text = Session["agentfirst"].ToString();
    }

        //POST LOGIC - For Step or Start pages
        protected void AlluWizard_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            int page = AlluWizard.ActiveStepIndex + 1;


            if (page == 1)
            {

                ((DataAccess)Session["App"]).PutCallData("ZipCode", "string", ZipCode.Text);
                
            }

            if (page == 2)
            {
                switch (radioMenu.SelectedValue.ToString())
                {
                    case "1":
                        AlluWizard.ActiveStepIndex = AlluWizard.WizardSteps.IndexOf(ProductOverview);
                        break;
                    case "2":
                        AlluWizard.ActiveStepIndex = AlluWizard.WizardSteps.IndexOf(OrderNotReceived);
                        break;
                    case "3":
                        AlluWizard.ActiveStepIndex = AlluWizard.WizardSteps.IndexOf(WantToCancelReceived);
                        break;
                    case "4":
                        AlluWizard.ActiveStepIndex = AlluWizard.WizardSteps.IndexOf(WantToCancelNotReceived);
                        break;
                    default:
                        AlluWizard.ActiveStepIndex = AlluWizard.WizardSteps.IndexOf(OrderConfirmation);
                        break;
                }
                ((DataAccess)Session["App"]).PutCallData("OrderConfirmationSelection", radioMenu.SelectedValue.ToString());
            }

            if (page == 3)
            {
               
            }
            if (page == 4)
            {
                
            }
            if (page == 5)
            {
                                
            }
            if (page == 6)
            {
                
            }
            if (page == 7)
            {
            }
 

        }

        //POST LOGIC for finish pages
        protected void AlluWizard_FinishButtonClick(object sender, WizardNavigationEventArgs e)
        {
            int page = AlluWizard.ActiveStepIndex + 1;
            if (page == 1)
            {
            }
            if (page == 2)
            {
            }
            if (page == 3)
            {
                ((DataAccess)Session["App"]).PutCallData("webusercode", "R3");
                AlluWizard.ActiveStepIndex = AlluWizard.WizardSteps.IndexOf(this.Disposition);
            }
            if (page == 4)
            {
                ((DataAccess)Session["App"]).PutCallData("webusercode", "R2");
                AlluWizard.ActiveStepIndex = AlluWizard.WizardSteps.IndexOf(this.Disposition);
            }
            if (page == 5)
            {
                switch (CancelRecievedSelection.SelectedItem.Value.ToString())
                {
                    case "1":
                        ((DataAccess)Session["App"]).PutCallData("webusercode", "R4");
                        break;
                    case "2":
                        ((DataAccess)Session["App"]).PutCallData("webusercode", "R5");
                        break;
                    case "3":
                        ((DataAccess)Session["App"]).PutCallData("webusercode", "R6");
                        break;
                    case "4":
                        ((DataAccess)Session["App"]).PutCallData("webusercode", "R7");
                        break;
                    case "5":
                        ((DataAccess)Session["App"]).PutCallData("webusercode", "R8");
                        break;
                    case "6":
                        ((DataAccess)Session["App"]).PutCallData("webusercode", "R3");
                        break;
                    default:
                        ((DataAccess)Session["App"]).PutCallData("webusercode", "R3");
                        break;
                }
                
                AlluWizard.ActiveStepIndex = AlluWizard.WizardSteps.IndexOf(this.Disposition);
            }
            if (page == 6)
            {
                ((DataAccess)Session["App"]).PutCallData("CancelReceivedSelection", CancelRecievedSelection.SelectedItem.Value.ToString());
                ((DataAccess)Session["App"]).PutCallData("webusercode", "R8");
                AlluWizard.ActiveStepIndex = AlluWizard.WizardSteps.IndexOf(this.Disposition);
            }
            if (page == 7)
            {
            }
            

        }

        //PRE-LOGIC
        protected void AlluWizard_ActiveStepChanged(object sender, EventArgs e)
        {
            if (AlluWizard.ActiveStep.Title.ToString() == "Disposition")
            {
                ((DataAccess)Session["App"]).CommitCallData();
            }

        }


    }
    
